/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uk.ac.staffs.student.autopilot.packet;

/**
 * 
 * @author Peter
 */
public class GpsPacket implements PacketInterface {

    private int dataType;
    /*
     * Latitude
     */
    private long latitude;
    private long longitude;
    private long altitude;
    private long groundSpeed;
    private long groundCourse;
    private int numSats;
    private int fix;
    private long time;
    private int checkSum;

    public GpsPacket() {
        latitude = 0;
        longitude = 0;
        altitude = 0;
        groundSpeed = 0;
        groundCourse = 0;
        numSats = 0;
        fix = 0;
        time = 0;
        checkSum = 0;
    }

    public GpsPacket(final int dataType, final long latitude,
            final long longitude, final long altitude,
            final long groundSpeed, final long groundCourse,
            final int numSats, final int fix, final long time, final int checkSum) {
        super();
        this.dataType = dataType;
        this.latitude = latitude;
        this.longitude = longitude;
        this.altitude = altitude;
        this.groundSpeed = groundSpeed;
        this.groundCourse = groundCourse;
        this.numSats = numSats;
        this.fix = fix;
        this.time = time;
        this.checkSum = checkSum;
    }

    @Override
    public int getPacketType() {

        return dataType;
    }

    @Override
    public String getPayload() {
        // TODO Auto-generated method stub
        return "" + latitude + longitude + altitude + groundSpeed
                + groundCourse + fix + time + "";
    }

    /**
     * @return the checkSum
     */
    @Override
    public int getCheckSum() {
        return checkSum;
    }

    /**
     * @return the dataType
     */
    public int getDataType() {
        return dataType;
    }

    @Override
    public String toString() {
        return "GpsPacket [dataType=" + dataType + ", latitude=" + latitude
                + ", longitude=" + longitude + ", altitude=" + altitude
                + ", groundSpeed=" + groundSpeed + ", groundCourse="
                + groundCourse + ", numSat=" + numSats + ", fix=" + fix + ", time=" + time
                + ", checkSum=" + checkSum + "]";
    }
    public long getLatitude() {
		return latitude;
	}

	public void setLatitude(long latitude) {
		this.latitude = latitude;
	}

	public long getLongitude() {
		return longitude;
	}

	public void setLongitude(long longitude) {
		this.longitude = longitude;
	}

	public long getAltitude() {
		return altitude;
	}

	public void setAltitude(long altitude) {
		this.altitude = altitude;
	}

	public long getGroundSpeed() {
		return groundSpeed;
	}

	public void setGroundSpeed(long groundSpeed) {
		this.groundSpeed = groundSpeed;
	}

	public long getGroundCourse() {
		return groundCourse;
	}

	public void setGroundCourse(long groundCourse) {
		this.groundCourse = groundCourse;
	}

	public int getNumSats() {
		return numSats;
	}

	public void setNumSats(int numSats) {
		this.numSats = numSats;
	}

	public int getFix() {
		return fix;
	}

	public void setFix(int fix) {
		this.fix = fix;
	}

	public long getTime() {
		return time;
	}

	public void setTime(long time) {
		this.time = time;
	}

	public void setDataType(int dataType) {
		this.dataType = dataType;
	}
    

    public void setCheckSum(final int checkSum) {
        this.checkSum = checkSum;
    }

}
